1
|
|
|
/*! |
2
|
|
|
* Bootstrap popover.js v4.6.2 (https://getbootstrap.com/) |
3
|
|
|
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) |
4
|
|
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
5
|
|
|
*/ |
6
|
|
|
(function (global, factory) { |
7
|
|
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./tooltip.js')) : |
8
|
|
|
typeof define === 'function' && define.amd ? define(['jquery', './tooltip'], factory) : |
|
|
|
|
9
|
|
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.jQuery, global.Tooltip)); |
|
|
|
|
10
|
|
|
})(this, (function ($, Tooltip) { 'use strict'; |
11
|
|
|
|
12
|
|
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } |
13
|
|
|
|
14
|
|
|
var $__default = /*#__PURE__*/_interopDefaultLegacy($); |
15
|
|
|
var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip); |
16
|
|
|
|
17
|
|
|
function _defineProperties(target, props) { |
18
|
|
|
for (var i = 0; i < props.length; i++) { |
19
|
|
|
var descriptor = props[i]; |
20
|
|
|
descriptor.enumerable = descriptor.enumerable || false; |
21
|
|
|
descriptor.configurable = true; |
22
|
|
|
if ("value" in descriptor) descriptor.writable = true; |
|
|
|
|
23
|
|
|
Object.defineProperty(target, descriptor.key, descriptor); |
24
|
|
|
} |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
function _createClass(Constructor, protoProps, staticProps) { |
28
|
|
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
|
|
|
|
29
|
|
|
if (staticProps) _defineProperties(Constructor, staticProps); |
|
|
|
|
30
|
|
|
Object.defineProperty(Constructor, "prototype", { |
31
|
|
|
writable: false |
32
|
|
|
}); |
33
|
|
|
return Constructor; |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
function _extends() { |
37
|
|
|
_extends = Object.assign ? Object.assign.bind() : function (target) { |
|
|
|
|
38
|
|
|
for (var i = 1; i < arguments.length; i++) { |
39
|
|
|
var source = arguments[i]; |
40
|
|
|
|
41
|
|
|
for (var key in source) { |
|
|
|
|
42
|
|
|
if (Object.prototype.hasOwnProperty.call(source, key)) { |
43
|
|
|
target[key] = source[key]; |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
return target; |
49
|
|
|
}; |
50
|
|
|
return _extends.apply(this, arguments); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
function _inheritsLoose(subClass, superClass) { |
54
|
|
|
subClass.prototype = Object.create(superClass.prototype); |
55
|
|
|
subClass.prototype.constructor = subClass; |
56
|
|
|
|
57
|
|
|
_setPrototypeOf(subClass, superClass); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
function _setPrototypeOf(o, p) { |
61
|
|
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { |
62
|
|
|
o.__proto__ = p; |
63
|
|
|
return o; |
64
|
|
|
}; |
65
|
|
|
return _setPrototypeOf(o, p); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Constants |
70
|
|
|
*/ |
71
|
|
|
|
72
|
|
|
var NAME = 'popover'; |
73
|
|
|
var VERSION = '4.6.2'; |
74
|
|
|
var DATA_KEY = 'bs.popover'; |
75
|
|
|
var EVENT_KEY = "." + DATA_KEY; |
76
|
|
|
var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME]; |
77
|
|
|
var CLASS_PREFIX = 'bs-popover'; |
78
|
|
|
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); |
79
|
|
|
var CLASS_NAME_FADE = 'fade'; |
80
|
|
|
var CLASS_NAME_SHOW = 'show'; |
81
|
|
|
var SELECTOR_TITLE = '.popover-header'; |
82
|
|
|
var SELECTOR_CONTENT = '.popover-body'; |
83
|
|
|
|
84
|
|
|
var Default = _extends({}, Tooltip__default["default"].Default, { |
85
|
|
|
placement: 'right', |
86
|
|
|
trigger: 'click', |
87
|
|
|
content: '', |
88
|
|
|
template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' |
89
|
|
|
}); |
90
|
|
|
|
91
|
|
|
var DefaultType = _extends({}, Tooltip__default["default"].DefaultType, { |
92
|
|
|
content: '(string|element|function)' |
93
|
|
|
}); |
94
|
|
|
|
95
|
|
|
var Event = { |
96
|
|
|
HIDE: "hide" + EVENT_KEY, |
97
|
|
|
HIDDEN: "hidden" + EVENT_KEY, |
98
|
|
|
SHOW: "show" + EVENT_KEY, |
99
|
|
|
SHOWN: "shown" + EVENT_KEY, |
100
|
|
|
INSERTED: "inserted" + EVENT_KEY, |
101
|
|
|
CLICK: "click" + EVENT_KEY, |
102
|
|
|
FOCUSIN: "focusin" + EVENT_KEY, |
103
|
|
|
FOCUSOUT: "focusout" + EVENT_KEY, |
104
|
|
|
MOUSEENTER: "mouseenter" + EVENT_KEY, |
105
|
|
|
MOUSELEAVE: "mouseleave" + EVENT_KEY |
106
|
|
|
}; |
107
|
|
|
/** |
108
|
|
|
* Class definition |
109
|
|
|
*/ |
110
|
|
|
|
111
|
|
|
var Popover = /*#__PURE__*/function (_Tooltip) { |
112
|
|
|
_inheritsLoose(Popover, _Tooltip); |
113
|
|
|
|
114
|
|
|
function Popover() { |
115
|
|
|
return _Tooltip.apply(this, arguments) || this; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
var _proto = Popover.prototype; |
119
|
|
|
|
120
|
|
|
// Overrides |
121
|
|
|
_proto.isWithContent = function isWithContent() { |
122
|
|
|
return this.getTitle() || this._getContent(); |
123
|
|
|
}; |
124
|
|
|
|
125
|
|
|
_proto.addAttachmentClass = function addAttachmentClass(attachment) { |
126
|
|
|
$__default["default"](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); |
127
|
|
|
}; |
128
|
|
|
|
129
|
|
|
_proto.getTipElement = function getTipElement() { |
130
|
|
|
this.tip = this.tip || $__default["default"](this.config.template)[0]; |
131
|
|
|
return this.tip; |
132
|
|
|
}; |
133
|
|
|
|
134
|
|
|
_proto.setContent = function setContent() { |
135
|
|
|
var $tip = $__default["default"](this.getTipElement()); // We use append for html objects to maintain js events |
136
|
|
|
|
137
|
|
|
this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle()); |
138
|
|
|
|
139
|
|
|
var content = this._getContent(); |
140
|
|
|
|
141
|
|
|
if (typeof content === 'function') { |
142
|
|
|
content = content.call(this.element); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
this.setElementContent($tip.find(SELECTOR_CONTENT), content); |
146
|
|
|
$tip.removeClass(CLASS_NAME_FADE + " " + CLASS_NAME_SHOW); |
147
|
|
|
} // Private |
148
|
|
|
; |
149
|
|
|
|
150
|
|
|
_proto._getContent = function _getContent() { |
151
|
|
|
return this.element.getAttribute('data-content') || this.config.content; |
152
|
|
|
}; |
153
|
|
|
|
154
|
|
|
_proto._cleanTipClass = function _cleanTipClass() { |
155
|
|
|
var $tip = $__default["default"](this.getTipElement()); |
156
|
|
|
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); |
157
|
|
|
|
158
|
|
|
if (tabClass !== null && tabClass.length > 0) { |
159
|
|
|
$tip.removeClass(tabClass.join('')); |
160
|
|
|
} |
161
|
|
|
} // Static |
162
|
|
|
; |
163
|
|
|
|
164
|
|
|
Popover._jQueryInterface = function _jQueryInterface(config) { |
165
|
|
|
return this.each(function () { |
166
|
|
|
var data = $__default["default"](this).data(DATA_KEY); |
167
|
|
|
|
168
|
|
|
var _config = typeof config === 'object' ? config : null; |
169
|
|
|
|
170
|
|
|
if (!data && /dispose|hide/.test(config)) { |
171
|
|
|
return; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
if (!data) { |
175
|
|
|
data = new Popover(this, _config); |
176
|
|
|
$__default["default"](this).data(DATA_KEY, data); |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
if (typeof config === 'string') { |
180
|
|
|
if (typeof data[config] === 'undefined') { |
181
|
|
|
throw new TypeError("No method named \"" + config + "\""); |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
data[config](); |
185
|
|
|
} |
186
|
|
|
}); |
187
|
|
|
}; |
188
|
|
|
|
189
|
|
|
_createClass(Popover, null, [{ |
190
|
|
|
key: "VERSION", |
191
|
|
|
get: // Getters |
192
|
|
|
function get() { |
193
|
|
|
return VERSION; |
194
|
|
|
} |
195
|
|
|
}, { |
196
|
|
|
key: "Default", |
197
|
|
|
get: function get() { |
198
|
|
|
return Default; |
199
|
|
|
} |
200
|
|
|
}, { |
201
|
|
|
key: "NAME", |
202
|
|
|
get: function get() { |
203
|
|
|
return NAME; |
204
|
|
|
} |
205
|
|
|
}, { |
206
|
|
|
key: "DATA_KEY", |
207
|
|
|
get: function get() { |
208
|
|
|
return DATA_KEY; |
209
|
|
|
} |
210
|
|
|
}, { |
211
|
|
|
key: "Event", |
212
|
|
|
get: function get() { |
213
|
|
|
return Event; |
214
|
|
|
} |
215
|
|
|
}, { |
216
|
|
|
key: "EVENT_KEY", |
217
|
|
|
get: function get() { |
218
|
|
|
return EVENT_KEY; |
219
|
|
|
} |
220
|
|
|
}, { |
221
|
|
|
key: "DefaultType", |
222
|
|
|
get: function get() { |
223
|
|
|
return DefaultType; |
224
|
|
|
} |
225
|
|
|
}]); |
226
|
|
|
|
227
|
|
|
return Popover; |
228
|
|
|
}(Tooltip__default["default"]); |
229
|
|
|
/** |
230
|
|
|
* jQuery |
231
|
|
|
*/ |
232
|
|
|
|
233
|
|
|
|
234
|
|
|
$__default["default"].fn[NAME] = Popover._jQueryInterface; |
235
|
|
|
$__default["default"].fn[NAME].Constructor = Popover; |
236
|
|
|
|
237
|
|
|
$__default["default"].fn[NAME].noConflict = function () { |
238
|
|
|
$__default["default"].fn[NAME] = JQUERY_NO_CONFLICT; |
239
|
|
|
return Popover._jQueryInterface; |
240
|
|
|
}; |
241
|
|
|
|
242
|
|
|
return Popover; |
243
|
|
|
|
244
|
|
|
})); |
245
|
|
|
//# sourceMappingURL=popover.js.map |
246
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.